package com.school.mydesk.teacher.service;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.school.mydesk.teacher.dao.TeacherDAO;
import com.school.mydesk.teacher.entity.Teacher;
import com.school.util.Parameter;
import com.school.util.UI;

@Service
public class TeacherServiceImpl implements TeacherService{
	@Resource
	private TeacherDAO tdao;
	
	@Override
	public Map<String, Object> getTeacherAll(Teacher teacher,Parameter p) {
		List<Teacher> list = tdao.getTeacherAll(p);
		int row = tdao.getRows(Teacher.class,"");
		return UI.getCommon().getGridMap(list, row);
	}

	@Override
	public boolean persistTeacher(Teacher teacher) {
		boolean bo =false;
		try {
			tdao.persist(teacher);
			bo=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bo;
	}
}
